package uk.ac.lkl.lpp.model.ldo;



import java.util.*;

//import uk.ac.lkl.common.util.Linkable;



/**
 * A cognitive activity such as discussing, analysing, etc.
 * 
 * Currently, the five different cognitive activities are made available both as
 * a list and as individual static members. Ultimately, these definitions will
 * end up in an XML file so that the theory underlying cognitive activities can
 * be plugged in appropriately with different names, ontologies, etc.
 * 
 * @author Darren Pearce
 * @version $Revision: 566 $
 * @version $Date: 2008-02-07 09:40:15 +0000 (Thu, 07 Feb 2008) $
 * 
 */
public class CognitiveActivity extends LearningEntity {

    /**
     * The list of cognitive activities.
     * 
     * This list is edited in the constructor of this class so that a list of
     * all existing instances is easily available.
     * 
     */
    private static ArrayList<CognitiveActivity> COGNITIVE_ACTIVITIES = new ArrayList<CognitiveActivity>();


    public CognitiveActivity(String title) {
        this(title, "");
    }


    public CognitiveActivity(String title, String description) {
        super(title, description);
        COGNITIVE_ACTIVITIES.add(this);
    }


    public static CognitiveActivity getCognitiveActivity(String title) {
        // hack: inefficient since processes whole list. Can't use
        // hashmap from string to activity since table model needs
        // index access to list. Need to fix this. Minor issue.
        for (CognitiveActivity activity : COGNITIVE_ACTIVITIES)
            if (activity.getTitle().equals(title))
                return activity;
        return null;
    }


    public static List<CognitiveActivity> getCognitiveActivities() {
        return Collections.unmodifiableList(COGNITIVE_ACTIVITIES);
    }


    public String getType() {
        return "Cognitive Activity";
    }

}
